<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib prefix="t" uri="http://myfaces.apache.org/tomahawk"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body bgcolor="#99CCFF">
	<f:view>
		<center>
			<h:form>
				<h:commandButton type="submit" value="Create Tables"
					action="#{actionBeanDatabaseAccess.createTables}" />
				<h:commandButton type="submit" value="Drop Tables"
					action="#{actionBeanDatabaseAccess.dropTables}" />
				<h:commandButton type="submit" value="Display Tables"
					action="#{actionBeanDatabaseAccess.displayTables}" />
				<h:commandButton type="submit" value="Import Worksheet"
					action="fileImport?faces-redirect=true" />
				<h:commandButton type="submit" value="Export Worksheet"
					action="fileExport?faces-redirect=true" />
			</h:form>
		</center>

		<br />
		<hr />
		<br />

		<h:outputText value="#{messageBean.errorMessage}" />
		<h:outputText value="#{messageBean.message}" />

		<h:panelGrid columns="2" rendered="#{dbaseBean.renderResult}">
			<h:outputText value="SQL query:" />
			<h:outputText value="#{dbaseBean.sqlQuery}" />
			<h:outputText value="Column names:" />
			<h:outputText value="#{dbaseBean.columnNames}" />
			<h:outputText value="Number of columns:" />
			<h:outputText value="#{dbaseBean.numberColumns}" />
			<h:outputText value="Number of rows:" />
			<h:outputText value="#{dbaseBean.numberRows}" />
		</h:panelGrid>

		<f:verbatim>
			<br />
			<hr />
			<br />
		</f:verbatim>

		<div
			style="background-attachment: scroll; overflow: auto; height: 400px; background-repeat: repeat">

			<t:dataTable value="#{dbaseBean.result}" var="row" 
				rendered="#{dbaseBean.renderResult}" border="1" cellspacing="0"
				cellpadding="1" columnClasses="columnClass1 border"
				headerClass="headerClass" footerClass="footerClass"
				rowClasses="rowClass2" styleClass="dataTableEx" width="900">

				<t:columns var="col" value="#{dbaseBean.columnNames}">

					<f:facet name="header">
						<t:outputText styleClass="outputHeader" value="#{col}" />
					</f:facet>

					<t:outputText styleClass="outputText" value="#{row[col]}" />
				</t:columns>

			</t:dataTable>

		</div>

	</f:view>
</body>
</html>